package com.buer.train.business.service.impl;

import com.buer.train.business.dao.TrainTypeDao;
import com.buer.train.business.domain.TrainTypeDO;
import com.buer.train.business.service.TrainTypeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;



@Service
public class TrainTypeServiceImpl implements TrainTypeService {
	@Autowired
	private TrainTypeDao trainTypeDao;
	
	@Override
	public TrainTypeDO get(Integer id){
		return trainTypeDao.get(id);
	}
	
	@Override
	public List<TrainTypeDO> list(Map<String, Object> map){
		return trainTypeDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return trainTypeDao.count(map);
	}
	
	@Override
	public int save(TrainTypeDO trainType){
		return trainTypeDao.save(trainType);
	}
	
	@Override
	public int update(TrainTypeDO trainType){
		return trainTypeDao.update(trainType);
	}
	
	@Override
	public int remove(Integer id){
		return trainTypeDao.remove(id);
	}
	
	@Override
	public int batchRemove(Integer[] ids){
		return trainTypeDao.batchRemove(ids);
	}

    @Override
    public PageInfo<TrainTypeDO> getTrainTypeList(Map<String, Object> map) {
        PageHelper.startPage(map); //开始起始页
        List<TrainTypeDO> list = trainTypeDao.getTrainTypeList(map); // 获取数据
        PageInfo<TrainTypeDO> page = new PageInfo<>(list); // 实例化PageInfo
        return page;
    }

    @Override
    public TrainTypeDO getOne(Map<String, Object> map){
        return trainTypeDao.getOne(map);
    }
	
}
